<?php
include "../include/global.php";
include "../include/admin_check.php";
include "../../FCKeditor/fckeditor.php";
$xtpl = new XTemplate ("galleryWrite.htm");
include "setting.php";
//
include "../include/function.php";
$xtpl->assign("left_panel", left_panel());
$xtpl->assign("header_panel", header_panel());
$xtpl->assign("footer_panel", footer_panel());

// ++ lang
if($lang=='v'){
	$xtpl->assign('type_vietnamese', 'onkeyup="initTyper(this)"');
}
$xtpl->assign("title", Gallery);
$xtpl->assign("lbl_search", Search);
$xtpl->assign("lbl_no", No);
$xtpl->assign("lbl_name", Name);
$xtpl->assign("lbl_image", Image);
$xtpl->assign("lbl_position", Position);
$xtpl->assign("lbl_active", Active);
$xtpl->assign("lbl_save", Save);
$xtpl->assign("lbl_save_add", SaveAdd);
$xtpl->assign("lbl_cancel", Cancel);
$xtpl->assign("lbl_close", Close);
// -- lang

$tour_id = intval($_GET['tour_id']);
$xtpl->assign("tour_id", $tour_id);

$hotel_id = intval($_GET['hotel_id']);
$xtpl->assign("hotel_id", $hotel_id);

$destination_id = intval($_GET['destination_id']);
$xtpl->assign("destination_id", $destination_id);

$ID=intval($_GET['ID']);
if($ID){
	$sql="select * from ".pre_table."gallery where gallery_id='$ID'";
	$row=recordset($sql);

	$gallery_name=$row['gallery_name'];	
	$gallery_position=$row['gallery_position'];	
	$gallery_isactive=$row['gallery_isactive'];	
	$old_gallery_image=$row['gallery_image'];
		
	if($row[gallery_isactive]==1) $ChkActive = "checked";			
	
	
	$xtpl->assign("gallery_name", $gallery_name);
	$xtpl->assign("old_gallery_image", $old_gallery_image);
	$xtpl->assign("gallery_position", $gallery_position);
	$xtpl->assign("gallery_isactive", $gallery_isactive);
	$xtpl->assign("ChkActive", $ChkActive);
	$xtpl->assign("id", $ID);

	
	$xtpl->assign("type", "EDIT");	
}else{
	$xtpl->assign("type", "ADD");	
	$xtpl->assign("ChkActive", "checked");
}

//////////////////////////////////////
$xtpl->parse("MAIN");
eval("?".">".$xtpl->text("MAIN"));
?>